home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / bbsutil / bsrc_250.zip / BTCTL.C < prev    next >
C/C++ Source or Header  |  1991-09-15  |  33KB  |  795 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software, Co.                       */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          Freely Available<tm> Software.                 */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  (C) Copyright 1987-91, Bit Bucket Software Co., a Delaware Corporation. */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*               This module was written by Vince Perriello                 */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*                 BinkleyTerm OMMM Control File Generator                  */
  17. /*                                                                          */
  18. /*                                                                          */
  19. /*    For complete  details  of the licensing restrictions, please refer    */
  20. /*    to the License  agreement,  which  is published in its entirety in    */
  21. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.250.    */
  22. /*                                                                          */
  23. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  24. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  25. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  26. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  27. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  28. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  29. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  30. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  31. /*                                                                          */
  32. /*                                                                          */
  33. /* You can contact Bit Bucket Software Co. at any one of the following      */
  34. /* addresses:                                                               */
  35. /*                                                                          */
  36. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:343/491             */
  37. /* P.O. Box 460398                AlterNet 7:491/0                          */
  38. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  39. /*                                Internet f491.n343.z1.fidonet.org         */
  40. /*                                                                          */
  41. /* Please feel free to contact us at any time to share your comments about  */
  42. /* our software and/or licensing policies.                                  */
  43. /*                                                                          */
  44. /*--------------------------------------------------------------------------*/
  45.  
  46. #include <stdio.h>
  47. #include <signal.h>
  48. #include <ctype.h>
  49. #include <conio.h>
  50. #include <stdlib.h>
  51. #include <string.h>
  52. #include <sys/types.h>
  53. #include <sys/stat.h>
  54.  
  55. #ifdef __TURBOC__
  56. #include <alloc.h>
  57. #define _fmalloc(n) farmalloc (n)
  58. #define _ffree(n) farfree (n)
  59. #endif
  60.  
  61. #ifdef _MSC_VER
  62. #include <malloc.h>
  63. #endif
  64.  
  65. #ifdef __WATCOMC__
  66. #include <malloc.h>
  67. #endif
  68.  
  69. #ifdef __ZTC__
  70. #define _fmalloc(n) farmalloc (n)
  71. #define _ffree(n) farfree (n)
  72. #endif
  73.  
  74. typedef unsigned bit;
  75. typedef unsigned int word;
  76. typedef unsigned char byte;
  77.  
  78. struct parse_list {
  79.         int p_length;
  80.         char *p_string;
  81.         };
  82.  
  83. /*--------------------------------------------------------------------------*/
  84. /* The following is excerpted from the control structures used by Opus 1.10 */
  85. /* as it is currently implemented. The only part that really concerns BTCTL */
  86. /* is that part of the _PRM structure that contains the version number and  */
  87. /* the network address. Only those parts are actually handled by this code. */
  88. /* We suspect that no changes will be made in that part of the structure    */
  89. /* between now and the release of Opus 1.10. If I were you, I would make    */
  90. /* no such assumptions about the rest.                                      */
  91. /*--------------------------------------------------------------------------*/
  92.  
  93. #define  THIS_CTL_VERSION  16       /* PRM structure version number         */
  94.  
  95. #define CTLSIZE 1
  96. #define OFS     char*
  97.  
  98. #define  MAX_EXTERN         8       /* max. number of external programs     */
  99. #define  MAXCLASS          12       /* number of possible priv levels       */
  100. #define  ALIAS_CNT         15       /* number of matrix addresses           */
  101.  
  102. /*--------------------------------------------------------------------------*/
  103. /* FIDONET ADDRESS STRUCTURE                                                */
  104. /*--------------------------------------------------------------------------*/
  105. typedef struct _ADDRESS
  106.    {
  107.    word  Zone;
  108.    word  Net;
  109.    word  Node;
  110.    word  Point;
  111.    } ADDR;
  112.  
  113. /*--------------------------------------------------------------------------*/
  114. /* Attributes of a given class of users                                     */
  115. /*--------------------------------------------------------------------------*/
  116. struct   class_rec
  117.    {
  118.    byte  ClassPriv;
  119.    byte  class_fill;
  120.    int   max_time;      /* max cume time per day         */
  121.    int   max_call;      /* max time for one call         */
  122.    int   max_dl;        /* max dl bytes per day          */
  123.    word  ratio;         /* ul:dl ratio                   */
  124.    word  min_baud;      /* speed needed for logon        */
  125.    word  min_file_baud; /* speed needed for file xfer    */
  126.    };
  127.  
  128. /*--------------------------------------------------------------------------*/
  129. /* Registers to pass to a FOSSIL appendage                                  */
  130. /*--------------------------------------------------------------------------*/
  131. struct _FOSREGS
  132.    {
  133.    word  ax;
  134.    word  bx;
  135.    word  cx;
  136.    word  dx;
  137.    };
  138.  
  139. /*--------------------------------------------------------------------------*/
  140. /* The format of the PRM file, VERSION 16                                   */
  141. /*                                                                          */
  142. /* THIS IS AN EXPLOSIVE STRUCTURE.  IT IS SUBJECT TO CHANGE WITH NO NOTICE. */
  143. /*                                                                          */
  144. /* Offsets to the following item(s) are guaranteed:                         */
  145. /*                                                                          */
  146. /*      byte   version;        // OFFSET 0, all versions                    */
  147. /*      byte   task_num;       // OFFSET 1, 16+                             */
  148. /*                                                                          */
  149. /*--------------------------------------------------------------------------*/
  150.  
  151. struct _PRM
  152.    {
  153.                /*-----------------------------------------------------------*/
  154.                /* DATA                                                      */
  155.                /*-----------------------------------------------------------*/
  156.          byte  version;        /* for safety                          STABLE*/
  157.          byte  task_num;       /* for multi-tasking systems           STABLE*/
  158.          ADDR  alias[ALIAS_CNT];
  159.  
  160.          byte  video;          /* 0=Dos, 1=Fossil 2=IBM                     */
  161.          byte  testmode;       /* input from keyboard, not modem            */
  162.  
  163.          word  carrier_mask;
  164.          word  handshake_mask;
  165.          word